<%@ page contentType="text/html;charset=UTF-8" isELIgnored="false" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>

</head>
<body>
<input type="button" value="新增" id="add"><br>
<script>
    document.getElementById("add").onclick = function (){
        location.href = "/student/Add.jsp";
    }
</script>
<hr>
<table border="1" cellspacing="0" width="80%">
    <tr>
        <th>序号</th>
        <th>姓名</th>
        <th>生日</th>
        <th>数学成绩</th>
        <th>英语成绩</th>
        <th>班级名字</th>
        <th>地址</th>
    </tr>

    <c:forEach items="${students}" var="student" varStatus="status">
        <tr align="center">
                <%--<td>${brand.id}</td>--%>
            <td>${status.count}</td>
            <td>${student.sname}</td>
            <td>${student.birthday}</td>
            <td>${student.math}</td>
            <td>${student.english}</td>
            <td>${student.className}</td>
            <td>${student.address}</td>

            <td><a href="/student/SelectByIDServlet?id=${student.id}">修改</a>
                <a href="#" id="${status.count}">删除</a></td>

            <script>
                document.getElementById("${status.count}").onclick=function () {
                    if (confirm("确认删除？")){
                        location.href="/student/DeleteServlet?id=${student.id}"
                    }
                }
            </script>
        </tr>
    </c:forEach>
</table>
</body>
</html>